package com.paul.sys.util;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.net.URISyntaxException;
import java.net.URL;
import java.util.Properties;

public class ResourceUtil {
	private static Properties properties;
	
	private ResourceUtil() {
	}
	
	static {
		FileInputStream fis = null;
		try {
			URL url = ResourceUtil.class.getClassLoader().getResource("resource_zh_CN.properties");
			fis = new FileInputStream(new File(url.toURI()));  
			properties = new Properties();
			properties.load(fis);
		} catch (URISyntaxException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		} finally {
			try {
				if (fis != null) {
					fis.close();
				}
			} catch (IOException e) {
				e.printStackTrace();
			}
		}
	}
	
	public static String getString(String key) {
		return properties.getProperty(key);
	}
}
